package com.mlz.mlzmall.ui.dialog;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;

import com.mlz.mlzmall.R;


/**
 * 弹框
 * ed by xbin on 2015/9/2.
 */
public class PhotoDialog {
    public static View pw;
    public static PopupWindow pWindow;
    public static Button btn_take_photo;
    public static Button btn_pick_photo;
    public static Button btn_cancel;
    private static Button btn_cancel2;

    public static void photo(final Context context) {
        //  退出对话框
        pw = LayoutInflater.from(context).inflate(R.layout.photo_layout, null);
        btn_cancel2 = (Button) pw.findViewById(R.id.btn_cancel2);
        btn_take_photo=(Button)pw.findViewById(R.id.btn_take_photo);
        btn_pick_photo=(Button)pw.findViewById(R.id.btn_pick_photo);
        btn_cancel=(Button)pw.findViewById(R.id.btn_cancel);
        pWindow = new PopupWindow(pw, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);//弹框显示大小
        pWindow.setFocusable(true);
        pWindow.setOutsideTouchable(true);
        pWindow.setBackgroundDrawable(new ColorDrawable(0x55000000));//设置背景为透明
     //   pWindow.setAnimationStyle(R.style.AnimationPush);
        pWindow.showAtLocation(pw, Gravity.BOTTOM, 0, 0);
        btn_cancel2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pWindow.dismiss();
            }
        });
    }

}
